package com.itfreer.power.service.jurisdiction;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.itfreer.form.api.BaseDao;
import com.itfreer.form.api.imp.DictionaryServiceImp;
import com.itfreer.form.dictionary.base.DictionaryItem;
import com.itfreer.power.dao.jurisdiction.MapExtentJurisdictionDao;
import com.itfreer.power.entity.jurisdiction.MapExtentJurisdictionEntity;

@Component("mapExtentJurisdictionService")
public class MapExtentJurisdictionServiceBase extends DictionaryServiceImp<MapExtentJurisdictionEntity> implements MapExtentJurisdictionService {

	@Autowired
	private MapExtentJurisdictionDao mapExtentJurisdictionDao;

	@Override
	protected BaseDao<MapExtentJurisdictionEntity> getDao() {
		return mapExtentJurisdictionDao;
	}

	@Override
	public String getDictionaryName() {
		return "p_mapextent_jurisdiction";
	}

	@Override
	protected DictionaryItem convert(MapExtentJurisdictionEntity entity) {
		DictionaryItem toEntity = new DictionaryItem();
		BeanUtils.copyProperties(entity, toEntity);
		toEntity.getOther().put("mapExtents", entity.getMapExtents());
		toEntity.getOther().put("registerService", entity.getRegisterService());
		return toEntity;
	}

	@Override
	protected String getDictionaryFields() {
		return "id,pid,code,display,valid,leaf,order,mapExtents,registerService";
	}
}
